def fun(x):
    if x//10 == 0:
        return x % 10
    return fun(x//10) + x % 10

print(fun(1234))                      